home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
extras
/
programm
/
gemfsc20
/
gemfsc20.lzh
/
GEMFUNCS
/
RCSCALE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-05
|
1KB
|
37 lines
/**************************************************************************
* RCSCALE.C - Scale sourcerect into destrect using specified percentage.
* The destination rectangle is g'teed to have width and
* height values of at least 1, since GEM and other lib
* library routines puke on no-area rectangles.
*************************************************************************/
#include "gemfintl.h"
GRECT *rc_scale(psource, pdest, percentage)
register GRECT *psource;
register GRECT *pdest;
register short percentage;
{
register short wdest;
register short hdest;
register short wsource;
register short hsource;
if (percentage < 0) {
percentage = 100;
}
wsource = psource->g_w;
hsource = psource->g_h;
wdest = (short)((wsource * (long)percentage) / 100);
hdest = (short)((hsource * (long)percentage) / 100);
pdest->g_x = psource->g_x + ((wsource - wdest) / 2);
pdest->g_y = psource->g_y + ((hsource - hdest) / 2);
pdest->g_w = wdest ? wdest : 1;
pdest->g_h = hdest ? hdest : 1;
return pdest;
}